<template>
  <div class="box">
    <div class="f2">
      <ul class="ul">
        <li>
          <el-form ref="ruleForm1" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业实际控制人姓名" prop="a">
              <el-input @blur="a" v-model="form.a"></el-input>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm2" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="当期财报年份" prop="b">
              <el-select @change="b" v-model="form.b">
                <el-option key="99" label="请选择" value=""></el-option>
                <el-option key="1" label="2022" value="2022"></el-option>
                <el-option key="2" label="2023" value="2023"></el-option>
                <el-option key="3" label="2024" value="2024"></el-option>
              </el-select>
            </el-form-item>
          </el-form>
        </li>
        <li style="position: relative">
          <el-form ref="ruleForm3" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业实际控制人身份证号" prop="c">
              <el-input type="string" @blur="c" v-model="form.c" />
              <p class="message" v-if="c1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm4" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业当期年度净利润" prop="d">
              <el-input
                v-model="addform.d"
                @focus="
                  () => {
                    this.addform.d = remoney(this.addform.d)
                  }
                "
                @blur="d"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <!--                 @input="limitInput($event, 'd')" -->
              <p class="message" v-if="d1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
        </li>
        <li style="position: relative">
          <el-form ref="ruleForm5" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业实际控制人手机号" prop="e">
              <el-input v-model="form.e" @blur="e"></el-input>
              <p class="message" v-if="e1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm6" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业上期年度净利润" prop="f">
              <el-input
                v-model="addform.f"
                @focus="
                  () => {
                    this.addform.f = remoney(this.addform.f)
                  }
                "
                @blur="f"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <!--                 @input="limitInput($event, 'f')" -->
              <p class="message" v-if="f1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
        </li>
        <li style="position: relative">
          <el-form ref="ruleForm7" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业进/出口业务年限" prop="g">
              <el-input v-model="form.g" @blur="g"></el-input>
              <p class="message" v-if="g1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm8" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业当期年度负债合计" prop="h">
              <el-input
                v-model="addform.h"
                @focus="
                  () => {
                    this.addform.h = remoney(this.addform.h)
                  }
                "
                @input="limitInput($event, 'h')"
                @blur="h"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <p class="message" v-if="h1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
        </li>
        <li style="position: relative">
          <el-form ref="ruleForm9" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业纳税人状态" prop="i">
              <el-select @change="i" v-model="form.i">
                <el-option key="99" label="请选择" value=""></el-option>
                <el-option key="1" label="正常" value="1"></el-option>
                <el-option key="2" label="非正常" value="2"></el-option>
              </el-select>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm10" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业上期年度负债合计" prop="j">
              <el-input
                v-model="addform.j"
                @focus="
                  () => {
                    this.addform.j = remoney(this.addform.j)
                  }
                "
                @input="limitInput($event, 'j')"
                @blur="j"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <p class="message" v-if="j1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
        </li>
        <li style="position: relative">
          <el-form ref="ruleForm11" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业纳税信用等级" prop="k">
              <el-select @change="k" v-model="form.k">
                <el-option key="99" label="请选择" value=""></el-option>
                <el-option key="1" label="A" value="A"></el-option>
                <el-option key="2" label="B" value="B"></el-option>
                <el-option key="3" label="C" value="C"></el-option>
                <el-option key="4" label="D" value="D"></el-option>
                <el-option key="5" label="M" value="M"></el-option>
              </el-select>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm12" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业当期年度资产合计 " prop="l">
              <el-input
                v-model="addform.l"
                @focus="
                  () => {
                    this.addform.l = remoney(this.addform.l)
                  }
                "
                @input="limitInput($event, 'l')"
                @blur="l"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <p class="message" v-if="l1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
        </li>
        <li style="position: relative">
          <el-form ref="ruleForm13" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业海关信用等级" prop="m">
              <el-select @change="m" v-model="form.m">
                <el-option key="99" label="请选择" value=""></el-option>
                <el-option key="1" label="高级认证企业" value="高级认证企业"></el-option>
                <el-option
                  key="2"
                  label="注册登记和备案企业"
                  value="注册登记和备案企业"
                ></el-option>
                <el-option key="3" label="失信企业" value="失信企业"></el-option>
              </el-select>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm14" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业上期年度资产合计" prop="n">
              <el-input
                v-model="addform.n"
                @focus="
                  () => {
                    this.addform.n = remoney(this.addform.n)
                  }
                "
                @input="limitInput($event, 'n')"
                @blur="n"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <p class="message" v-if="n1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
        </li>
        <li style="position: relative">
          <el-form ref="ruleForm15" :model="form" label-width="320px " :rules="rules">
            <el-form-item label="企业欠缴关税记录数" prop="o">
              <el-input v-model="form.o" @blur="o"></el-input>
              <p class="message" v-if="o1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm16" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="" prop="p">
              <p class="special_top">
                <span style="color: #f56c6c">*</span>
                最近12个月单月最高海关
              </p>
              <el-input
                v-model="addform.p"
                @focus="
                  () => {
                    this.addform.p = remoney(this.addform.p)
                  }
                "
                @input="limitInput($event, 'p')"
                @blur="p"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <p class="message" v-if="p1">格式错误，请重新输入</p>
              <p class="special_bottom">进口税费支付金额</p>
            </el-form-item>
          </el-form>
        </li>
        <li style="position: relative">
          <el-form ref="ruleForm17" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="企业上年度进口纳税金额" prop="q">
              <el-input
                v-model="addform.q"
                @focus="
                  () => {
                    this.addform.q = remoney(this.addform.q)
                  }
                "
                @input="limitInput($event, 'q')"
                @blur="q"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <p class="message" v-if="q1">格式错误，请重新输入</p>
            </el-form-item>
          </el-form>
          <el-form ref="ruleForm18" :model="form" label-width="320px" :rules="rules">
            <el-form-item label="" prop="r">
              <p class="special_top">
                <span style="color: #f56c6c">*</span>
                最近12个月海关进口税费
              </p>
              <el-input
                @blur="r"
                v-model="addform.r"
                @focus="
                  () => {
                    this.addform.r = remoney(this.addform.r)
                  }
                "
                @input="limitInput($event, 'r')"
              ></el-input>
              <p style="position: absolute; right: 15px; top: 0px; z-index: 99; font-size: 16px">
                元
              </p>
              <p class="message" v-if="r1">格式错误，请重新输入</p>
              <p class="special_bottom">支付金额</p>
            </el-form-item>
          </el-form>
        </li>
      </ul>
      <!-- 服务协议 -->
      <div class="agreement">
        <img
          @click="
            submitBtn(
              'ruleForm1',
              'ruleForm2',
              'ruleForm3',
              'ruleForm4',
              'ruleForm5',
              'ruleForm6',
              'ruleForm7',
              'ruleForm8',
              'ruleForm9',
              'ruleForm10',
              'ruleForm11',
              'ruleForm12',
              'ruleForm13',
              'ruleForm14',
              'ruleForm15',
              'ruleForm16',
              'ruleForm17',
              'ruleForm18'
            )
          "
          :src="require(`@/assets/shangpiao/组${radio ? '38' : '39'}.png`)"
          alt=""
        />
        <span> 阅读并同意 </span>
        <!-- href="http://operate.thunlink.cn/protocol/4 企业授权协议-商驿/4 企业授权协议-商驿.html"
          target="_back" -->
        <a
          @click="
            submitBtn(
              'ruleForm1',
              'ruleForm2',
              'ruleForm3',
              'ruleForm4',
              'ruleForm5',
              'ruleForm6',
              'ruleForm7',
              'ruleForm8',
              'ruleForm9',
              'ruleForm10',
              'ruleForm11',
              'ruleForm12',
              'ruleForm13',
              'ruleForm14',
              'ruleForm15',
              'ruleForm16',
              'ruleForm17',
              'ruleForm18'
            )
          "
          >《企业授权协议》</a
        >
        <!-- <a href="javascript:void(0)">《技术服务协议》</a> -->
      </div>
      <!-- 上一步/保存/提交 按钮 -->
      <div class="submit">
        <el-tooltip placement="top" v-if="!btn">
          <div slot="content">请勾选授权协议<br />确认填写的信息是否完整</div>
          <button
            class="btn btn3"
            v-bind:class="{
              active: btn & radio,
              actives: submitMessage == '提交中'
            }"
            @click="goNextFlow()"
          >
            {{ submitMessage }}
          </button>
        </el-tooltip>
        <button
          v-else
          class="btn btn3"
          v-bind:class="{
            active: btn & radio,
            actives: submitMessage == '提交中'
          }"
          @click="goNextFlow()"
        >
          {{ submitMessage }}
        </button>
      </div>
    </div>
    <!-- 弹窗 -->
    <!--签署协议弹窗开始 -->
    <el-dialog
      class="inviteAffirmClient"
      :closeOnClickModal="false"
      title=""
      :visible.sync="showAgreementVisible"
      width=""
    >
      <!-- 内容区域 -->
      <div class="dialog-center" v-loading="loading">
        <template v-if="list">
          <el-tabs v-model="activeName">
            <el-tab-pane v-for="item in list" :key="item.url" :label="item.name" :name="item.names">
              <div class="first">
                <iframe
                  style="border: none"
                  width="100%"
                  height="100%"
                  v-bind:src="item.url"
                ></iframe>
              </div>
            </el-tab-pane>
          </el-tabs>
        </template>
      </div>
      <!-- 按钮区域 -->
      <div slot="footer" class="dialog-footer">
        <button
          v-if="contractStatuss"
          :disabled="isLock"
          class="dialog-footer-bnt btn2"
          @click="aaaa"
        >
          确定
        </button>
        <button v-else :disabled="isLock" class="dialog-footer-bnt btn2" @click="sign">
          去签署
        </button>
      </div>
    </el-dialog>
    <!-- 签署协议弹窗结束 -->
    <!--签署协议提示开始 -->
    <el-dialog
      class="hint"
      :closeOnClickModal="false"
      title=""
      :visible.sync="hintVisible"
      width=""
    >
      <!-- 内容区域 -->
      <div class="dialog-center-hint">
        <p>
          签署短信已发送至经办人手机{{ operatetel | getPhone }}、法定代表人手机{{
            officertel | getPhone
          }}，请点击短信签署链接完成签署操作。
        </p>
      </div>
      <!-- 按钮区域 -->
      <div slot="footer" class="dialog-footer">
        <button
          style="background: #fff; color: #3f6ef2"
          class="dialog-footer-bnt btn2"
          @click="aaaa"
        >
          确定
        </button>
        <button
          v-bind:class="{ actives: submitMessage == '提交中' }"
          class="dialog-footer-bnt btn2"
          @click="goNextFlow()"
        >
          {{ submitMessage }}
        </button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {
  addKJApply,
  myPostFetch,
  busnessSubmits,
  Contracts,
  Contract,
  createContractReview,
  updateapplyid
} from '@/utils'
export default {
  data() {
    return {
      submitMessage: '提交',
      contractStatuss: true, //签署状态
      isLock: false,
      QYSQreportUrl: '',
      JSFWreportUrl: '',
      activeName: 'first', //标签页默认
      showAgreementVisible: false, //协议弹框:
      hintVisible: false,
      disabled: false,
      officertel: '', //法人手机号
      operatetel: '', //经办人手机号
      loading: true,

      list: null,
      radio: false, //企业授权服务状态变量
      btn: false, //提交按钮是否可用状态变量
      procedureId: '', // 从路由地址中获取产品ID,保存到状态变量中
      ProductList: null,
      gseb: [],
      index: '',
      apply: null,
      c1: false,
      d1: false,
      e1: false,
      f1: false,
      g1: false,
      h1: false,
      j1: false,
      l1: false,
      n1: false,
      o1: false,
      p1: false,
      q1: false,
      r1: false,
      form: {
        a: '',
        b: '',
        c: '',
        d: '',
        e: '',
        f: '',
        g: '',
        h: '',
        i: '',
        j: '',
        k: '',
        l: '',
        m: '',
        n: '',
        o: '',
        p: '',
        q: '',
        r: ''
      },
      // 用户填写资料表格
      addform: {
        a: '',
        b: '',
        c: '',
        d: '',
        e: '',
        f: '',
        g: '',
        h: '',
        i: '',
        j: '',
        k: '',
        l: '',
        m: '',
        n: '',
        o: '',
        p: '',
        q: '',
        r: ''
      },
      // 表单验证
      rules: {
        a: [{ required: true, message: ' ', trigger: 'blur' }],
        b: [{ required: true, message: ' ', trigger: 'blur' }],
        c: [{ required: true, message: ' ', trigger: 'blur' }],
        d: [{ required: true, message: ' ', trigger: 'blur' }],
        e: [{ required: true, message: ' ', trigger: 'blur' }],
        f: [{ required: true, message: ' ', trigger: 'blur' }],
        g: [{ required: true, message: ' ', trigger: 'blur' }],
        h: [{ required: true, message: ' ', trigger: 'blur' }],
        i: [{ required: true, message: ' ', trigger: 'blur' }],
        j: [{ required: true, message: ' ', trigger: 'blur' }],
        k: [{ required: true, message: ' ', trigger: 'blur' }],
        l: [{ required: true, message: ' ', trigger: 'blur' }],
        m: [{ required: true, message: ' ', trigger: 'blur' }],
        n: [{ required: true, message: ' ', trigger: 'blur' }],
        o: [{ required: true, message: ' ', trigger: 'blur' }],
        p: [{ required: true, message: ' ', trigger: 'blur' }],
        q: [{ required: true, message: ' ', trigger: 'blur' }],
        r: [{ required: true, message: ' ', trigger: 'blur' }]
      },
      // 合同签署数据
      contract: {
        // conno: "35555588889885545",
        // contype: "",
        applyid: '',
        entname: '',
        FRaccountid: '',
        inputdate: '',
        JBRaccountid: '',
        licenseno: '',
        mainindname: '',
        officer: '',
        officertel: '',
        ORGaccountid: '',
        productcode: '',
        radio: '',
        ticketadder: '',
        ticketbank: '',
        ticketbankno: '',
        tickethead: '',
        ticketno: '',
        tickettel: '',
        step: 'preapply'
      }
    }
  },
  // 过滤器
  filters: {
    // 手机号脱敏
    getPhone: function (value) {
      if (!value) return value
      value = value.replace(/(\d{3})\d*(\d{4})/, '$1****$2')
      return value
    }
  },
  // 生命周期方法
  mounted() {
    // 从路由地址中获取产品ID, 保存到状态变量中;
    this.procedureId = localStorage.getItem('id')
    this.productcode = localStorage.getItem('productcode')
    this.contract.productcode = localStorage.getItem('productcode')
    this.getFindproduct()
  },
  methods: {
    // 获取最上端产品列表
    async getFindproduct() {
      let url = '/api/BusinessSPs/findproduct'
      let params = {
        productcode: this.productcode
      }
      let data = await myPostFetch(url, params)
      this.ProductList = data.data
    },
    // 点击去签署按钮
    async sign() {
      this.isLock = true
      setTimeout(() => {
        this.isLock = false
      }, 500)
      this.loading = true
      let data = await Contract(this.contract)
      if (data.code == 100) {
        this.loading = false
        this.radio = true
        this.showAgreementVisible = false
        this.hintVisible = true
        this.flowId = data.data.flowId
        this.submitBtns()
      }
    },
    // 签署协议提示确认键
    aaaa() {
      this.radio = true
      this.showAgreementVisible = false
      this.submitBtns()
      this.hintVisible = false
    },
    // ----------------------------------------
    // 表单
    a() {
      this.submitBtns()
    },
    b() {
      this.submitBtns()
    },
    c() {
      this.c1 = false
      this.submitBtns()
      if (this.form.c == '') return
      let reg =
        /^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/
      if (!reg.test(this.form.c)) {
        this.form.c = ''
        this.c1 = true
      }
    },
    d(e) {
      this.d1 = false
      this.form.d = this.addform.d
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.d = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.d = this.fmoney(this.addform.d)

      let value = Number(this.form.d)
      this.submitBtns()
      if (this.form.d == '') return
      this.form.d = value.toFixed(2)
      if (isNaN(this.form.d)) {
        this.addform.d = ''
        this.d1 = true
      }
    },
    e() {
      this.e1 = false
      let value = Number(this.form.e)
      this.submitBtns()
      if (this.form.e == '') return
      this.form.e = value.toFixed(0)
      let reg = /^1[3-9]\d{9}$/
      if (!reg.test(this.form.e)) {
        this.form.e = ''
        this.e1 = true
      }

      if (isNaN(this.form.e)) {
        this.form.e = ''
        this.e1 = true
      }
    },
    f(e) {
      this.f1 = false
      this.form.f = this.addform.f
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.f = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.f = this.fmoney(this.addform.f)
      let value = Number(this.form.f)
      this.submitBtns()
      if (this.addform.f == '') return
      this.form.f = value.toFixed(2)
      if (isNaN(this.form.f)) {
        this.addform.f = ''
        this.f1 = true
      }
    },
    g() {
      this.g1 = false
      let value = Number(this.form.g)
      this.submitBtns()
      if (this.form.g == '') return
      this.form.g = value.toFixed(0)
      if (isNaN(this.form.g)) {
        this.form.g = ''
        this.g1 = true
      }
    },
    h(e) {
      this.h1 = false
      this.form.h = this.addform.h
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.h = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.h = this.fmoney(this.addform.h)

      let value = Number(this.form.h)
      this.submitBtns()
      if (this.form.h == '') return
      this.form.h = value.toFixed(2)
      if (isNaN(this.form.h)) {
        this.form.h = ''
        this.h1 = true
      }
    },
    i() {
      this.submitBtns()
    },
    j(e) {
      this.j1 = false

      this.form.j = this.addform.j
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.j = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.j = this.fmoney(this.addform.j)

      let value = Number(this.form.j)
      this.submitBtns()
      if (this.form.j == '') return
      this.form.j = value.toFixed(2)
      if (isNaN(this.form.j)) {
        this.form.j = ''
        this.j1 = true
      }
    },
    k() {
      this.submitBtns()
    },
    l(e) {
      this.l1 = false
      this.form.l = this.addform.l
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.l = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.l = this.fmoney(this.addform.l)

      let value = Number(this.form.l)
      this.submitBtns()
      if (this.form.l == '') return
      this.form.l = value.toFixed(2)
      if (isNaN(this.form.l)) {
        this.form.l = ''
        this.l1 = true
      }
    },
    m() {
      this.submitBtns()
    },
    n(e) {
      this.n1 = false
      this.form.n = this.addform.n
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.n = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.n = this.fmoney(this.addform.n)

      let value = Number(this.form.n)
      this.submitBtns()
      if (this.form.n == '') return
      this.form.n = value.toFixed(2)
      if (isNaN(this.form.n)) {
        this.form.n = ''
        this.n1 = true
      }
    },
    o() {
      this.o1 = false
      let value = Number(this.form.o)
      this.submitBtns()
      if (this.form.o == '') return
      this.form.o = value.toFixed(0)
      if (isNaN(this.form.o)) {
        this.form.o = ''
        this.o1 = true
      }
    },
    p(e) {
      this.p1 = false
      this.form.p = this.addform.p
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.p = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.p = this.fmoney(this.addform.p)

      let value = Number(this.form.p)
      this.submitBtns()
      if (this.form.p == '') return
      this.form.p = value.toFixed(2)
      if (isNaN(this.form.p)) {
        this.form.p = ''
        this.p1 = true
      }
    },
    q(e) {
      this.r1 = false
      this.form.q = this.addform.q
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.q = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.q = this.fmoney(this.addform.q)

      let value = Number(this.form.q)
      this.submitBtns()
      if (this.form.q == '') return
      this.form.q = value.toFixed(2)
      if (isNaN(this.form.q)) {
        this.form.q = ''
        this.q1 = true
      }
    },
    r(e) {
      this.r1 = false
      this.form.r = this.addform.r
      //获取输入的数据，若不写这行，数据可能输不进去
      this.addform.r = e.target.value
      //将用户输入的数据，自动转换为带千分符的
      this.addform.r = this.fmoney(this.addform.r)

      let value = Number(this.form.r)
      this.submitBtns()
      if (this.form.r == '') return
      this.form.r = value.toFixed(2)
      if (isNaN(this.form.r)) {
        this.form.r = ''
        this.r1 = true
      }
    },
    // 表单格式转换
    // 票面金额
    limitInput(value, name) {
      this.addform[name] =
        ('' + value) // 第一步：转成字符串
          .replace(/[^\d^\.]+/g, '') // 第二步：把不是数字，不是小数点的过滤掉
          .replace(/^0+(\d)/, '$1') // 第三步：第一位0开头，0后面为数字，则过滤掉，取后面的数字
          .replace(/^\./, '0.') // 第四步：如果输入的第一位为小数点，则替换成 0. 实现自动补全
          .match(/^\d*(\.?\d{0,2})/g)[0] || ''
    },
    //千分位格式化：10000转为10,000.00
    fmoney(s, n) {
      if (s == '' || s == null || (s == undefined) | isNaN(Number(s))) {
        return s
      }
      s = Number(s) ? Number(s) : s
      n = (n || n == 0) && n > -1 && n <= 20 ? n : 2
      s = parseFloat((s + '').replace(/[^\d\.-]/g, '')).toFixed(n) + ''
      var l = s.split('.')[0].split('').reverse()
      var r = s.split('.')[1]
      var t = ''
      for (var i = 0; i < l.length; i++) {
        t += l[i] + ((i + 1) % 3 == 0 && i + 1 != l.length ? ',' : '')
      }
      if (n > 0) {
        r = '.' + r
      } else if (n == 0) {
        r = ''
      }
      let returnT = t.split('').reverse().join('') + r
      //负数处理
      if (returnT[0] == '-' && returnT[1] == ',') {
        returnT = '-' + returnT.substring(2)
      }
      return returnT
    },
    //千分位反格式化:10,000.00转为10000.00
    remoney(s) {
      let str = ''
      if (s) {
        str = String(s).replace(/,/g, '')
      }
      if (s && (s + '').indexOf('.') > -1 && Number(str)) {
        return String(s).replace(/[^\d\.-]/g, '')
      } else if (s && Number(str)) {
        return str
      } else {
        return s
      }
    },
    // 产品申请第1步
    async goNextFlow() {
      if (this.submitMessage == '提交中') return
      if (
        this.btn &&
        this.radio &&
        this.form.a != '' &&
        this.form.b != '' &&
        this.form.c != '' &&
        this.form.d != '' &&
        this.form.e != '' &&
        this.form.f != '' &&
        this.form.g != '' &&
        this.form.h != '' &&
        this.form.i != '' &&
        this.form.j != '' &&
        this.form.k != '' &&
        this.form.l != '' &&
        this.form.m != '' &&
        this.form.n != '' &&
        this.form.o != '' &&
        this.form.p != '' &&
        this.form.q != '' &&
        this.form.r != ''
      ) {
        this.submitMessage = '提交中'
        let form = {
          entcontrollerneme: this.form.a,
          particularyear: this.form.b,
          certid: this.form.c,
          currentprofit: this.form.d,
          entcontrollephone: this.form.e,
          periodprofit: this.form.f,
          importyears: this.form.g,
          currentliabilities: this.form.h,
          taxpayerstatus: this.form.i,
          periodliabilities: this.form.j,
          creditrating: this.form.k,
          currentasset: this.form.l,
          customs: this.form.m,
          periodasset: this.form.n,
          enttariff: this.form.o,
          highestamount: this.form.p,
          paytaxesmoner: this.form.q,
          customsamount: this.form.r,
          productname: this.ProductList.productSub.productname,
          productid: this.procedureId,
          productcood: this.productcode
        }
        let data = await addKJApply(form)
        if (data.msg != 'ok') {
          this.$Message.error('提交失败，请检查申请信息')
          this.submitMessage = '提交'
          return
        }
        // 提交
        let a = await busnessSubmits(data.data.applyid)
        await updateapplyid(data.data.applyid, this.flowId)
        if (data.msg == 'ok' && a.msg == 'ok') {
          this.$Message.success('申请提交成功')
          this.$router.push('/cyedApplication3')
          this.hintVisible = false
          setTimeout(() => {
            this.submitMessage = '提交'
          }, 3000)
          setTimeout(() => {
            this.$router.go(0)
          }, 500)
        } else {
          this.$Message.error('提交失败，请检查申请信息')
          this.submitMessage = '提交'
        }
      }
    },
    // 点击勾选协议按钮
    async submitBtn(
      ruleForm1,
      ruleForm2,
      ruleForm3,
      ruleForm4,
      ruleForm5,
      ruleForm6,
      ruleForm7,
      ruleForm8,
      ruleForm9,
      ruleForm10,
      ruleForm11,
      ruleForm12,
      ruleForm13,
      ruleForm14,
      ruleForm15,
      ruleForm16,
      ruleForm17,
      ruleForm18
    ) {
      this.$refs[ruleForm1].validate(valid => {})
      this.$refs[ruleForm2].validate(valid => {})
      this.$refs[ruleForm3].validate(valid => {})
      this.$refs[ruleForm4].validate(valid => {})
      this.$refs[ruleForm5].validate(valid => {})
      this.$refs[ruleForm6].validate(valid => {})
      this.$refs[ruleForm7].validate(valid => {})
      this.$refs[ruleForm8].validate(valid => {})
      this.$refs[ruleForm9].validate(valid => {})
      this.$refs[ruleForm10].validate(valid => {})
      this.$refs[ruleForm11].validate(valid => {})
      this.$refs[ruleForm12].validate(valid => {})
      this.$refs[ruleForm13].validate(valid => {})
      this.$refs[ruleForm14].validate(valid => {})
      this.$refs[ruleForm15].validate(valid => {})
      this.$refs[ruleForm16].validate(valid => {})
      this.$refs[ruleForm17].validate(valid => {})
      this.$refs[ruleForm18].validate(valid => {})
      if (this.radio) return
      if (
        this.form.a == '' ||
        this.form.b == '' ||
        this.form.c == '' ||
        this.form.d == '' ||
        this.form.e == '' ||
        this.form.f == '' ||
        this.form.g == '' ||
        this.form.h == '' ||
        this.form.i == '' ||
        this.form.j == '' ||
        this.form.k == '' ||
        this.form.l == '' ||
        this.form.m == '' ||
        this.form.n == '' ||
        this.form.o == '' ||
        this.form.p == '' ||
        this.form.q == '' ||
        this.form.r == ''
      ) {
        return this.$Message.error('请填写内容')
      }
      let productcode = this.contract.productcode
      let parameter = {
        productcode: productcode,
        entname: sessionStorage.getItem('entname')
      }
      this.loading = true
      this.showAgreementVisible = true
      let data = await Contracts(parameter)
      if (data.code == 10000) {
        this.$Message.error('登录已过期，请重新登录')
        this.$router.push('/login')
        sessionStorage.clear()
        return
      }
      if (data.code != 100) {
        this.showAgreementVisible = false
        this.$Message.error('系统异常，请您稍后再试')
        this.loading = false
        return
      }
      this.officertel = data.data.ent.fincerttel
      this.operatetel = data.data.ent.operateTel
      this.contract.entname = data.data.ent.entname
      this.contract.FRaccountid = data.data.ent.fraccountid
      this.contract.inputdate = data.data.ent.inputdate
      this.contract.JBRaccountid = data.data.ent.jbRaccountid
      this.contract.licenseno = data.data.ent.licenseno
      this.contract.mainindname = data.data.ent.mainindname
      this.contract.officer = data.data.ent.operatename
      this.contract.officertel = data.data.ent.fincerttel
      this.contract.ORGaccountid = data.data.ent.qyaccountid
      data.data.coopeorg
        ? (this.contract.ticketbank = data.data.coopeorg.ticketbank)
        : (this.contract.ticketbank = '')
      data.data.coopeorg
        ? (this.contract.ticketbankno = data.data.coopeorg.ticketaccountno)
        : (this.contract.ticketbankno = '')
      data.data.coopeorg
        ? (this.contract.tickettel = data.data.coopeorg.tickettel)
        : (this.contract.tickettel = '')
      this.contract.radio = data.data.radio
      let GetcreateContractReview = await createContractReview(this.contract)
      if (GetcreateContractReview.code == 100) {
        this.contractStatuss = GetcreateContractReview.data.statuss
        if (this.contractStatuss) {
          this.list = GetcreateContractReview.data.data
          for (let i = 0; i < this.list.length; i++) {
            if (this.list[i].name == '企业授权协议.pdf') {
              this.list[i].name = this.list[i].name.split('.')[0]
              this.list[i].names = 'first'
            } else if (this.list[i].name == '技术服务协议.pdf') {
              this.list[i].name = this.list[i].name.split('.')[0]
              this.list[i].names = 'second'
            }
          }
          this.loading = false
        } else {
          this.list = GetcreateContractReview.data.data.file
          for (let i = 0; i < this.list.length; i++) {
            if (this.list[i].name == '企业授权协议.pdf') {
              this.list[i].name = this.list[i].name.split('.')[0]
              this.list[i].names = 'first'
            } else if (this.list[i].name == '技术服务协议.pdf') {
              this.list[i].name = this.list[i].name.split('.')[0]
              this.list[i].names = 'second'
            }
          }
          this.loading = false
        }
      } else {
        this.showAgreementVisible = false
        this.$Message.error('系统异常，请您稍后再试')
      }
      this.submitBtns()
      // if (
      //   this.form.a != "" &&
      //   this.form.b != "" &&
      //   this.form.c != "" &&
      //   this.form.d != "" &&
      //   this.form.e != "" &&
      //   this.form.f != "" &&
      //   this.form.g != "" &&
      //   this.form.h != "" &&
      //   this.form.i != "" &&
      //   this.form.j != "" &&
      //   this.form.k != "" &&
      //   this.form.l != "" &&
      //   this.form.m != "" &&
      //   this.form.n != "" &&
      //   this.form.o != "" &&
      //   this.form.p != "" &&
      //   this.form.q != "" &&
      //   this.form.r != ""
      // ) {
      //   this.btn = true;
      // } else {
      //   this.btn = false;
      // }
      // this.radio = !this.radio;
    },
    submitBtns() {
      if (
        this.form.a != '' &&
        this.form.b != '' &&
        this.form.c != '' &&
        this.form.d != '' &&
        this.form.e != '' &&
        this.form.f != '' &&
        this.form.g != '' &&
        this.form.h != '' &&
        this.form.i != '' &&
        this.form.j != '' &&
        this.form.k != '' &&
        this.form.l != '' &&
        this.form.m != '' &&
        this.form.n != '' &&
        this.form.o != '' &&
        this.form.p != '' &&
        this.form.q != '' &&
        this.form.r != '' &&
        this.radio
      ) {
        this.btn = true
      } else {
        this.btn = false
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.box {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #fff;
  .f1 {
    margin-top: 20px;
    @media only screen and (min-width: 1px) and (max-width: 900px) {
      display: none;
    }
    ul {
      display: flex;
      align-items: center;
      li {
        display: flex;
        flex-direction: column;
        height: 40px;

        .icon {
          .icon1 {
            width: 40px;
          }
          .icon2 {
            height: 3px;
            margin: 0 8px;
          }
        }
        span {
          font-size: 14px;
          font-family: Source Han Sans SC;
          font-weight: 400;
          color: #999999;
          margin-left: -19px;
          margin-top: 3px;
        }
      }
    }
  }
  .unit {
    position: relative;
    width: 90%;
    height: 20px;
    font-size: 16px;
    font-family: Source Han Sans SC;
    font-weight: 400;
    color: #b3b3b3;
    font-size: 14px;
    color: #606266;
    p {
      position: absolute;
      @media only screen and (min-width: 1580px) and (max-width: 1950px) {
        right: 15.1%;
      }
      right: 5.5%;
      top: -3px;
    }
  }
  .f2 {
    margin-top: 5%;
    width: 100%;
    ul {
      display: flex;
      flex-direction: column;
      justify-content: center;

      li {
        width: 90%;
        margin-bottom: 18px;
        height: 50px;
        display: flex;
        justify-content: center;
        .message {
          margin-top: -11px;
          font-size: 12px;
          font-family: Source Han Sans SC;
          font-weight: 300;
          color: #ef2d46;
        }
      }
    }
  }

  .f3 {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    bottom: 55px;
    @media only screen and (min-width: 1580px) and (max-width: 1950px) {
      bottom: 70px;
    }
    width: 275px;
    height: 34px;
    background: #3f6ef2;
    border-radius: 4px;
    font-size: 18px;
    font-family: Source Han Sans SC;
    font-weight: 400;
    color: #ffffff;
    cursor: pointer;
  }
  .special_top {
    position: absolute;
    @media only screen and (min-width: 0px) and (max-width: 1024px) {
      left: -1.52rem;
    }
    @media only screen and (min-width: 1025px) and (max-width: 1079px) {
      left: -1.5rem;
    }
    @media only screen and (min-width: 1080px) and (max-width: 1167px) {
      left: -1.4rem;
    }
    @media only screen and (min-width: 1168px) and (max-width: 1234px) {
      left: -1.28rem;
    }
    @media only screen and (min-width: 1235px) and (max-width: 1299px) {
      left: -1.21rem;
    }
    @media only screen and (min-width: 1300px) and (max-width: 1420px) {
      left: -1.15rem;
    }
    @media only screen and (min-width: 1420px) and (max-width: 2580px) {
      left: -1.1rem;
    }
    top: -0.0469rem;
    font-size: 0.0885rem;
    color: #1f1f20;
  }
  .special_bottom {
    position: absolute;
    @media only screen and (min-width: 0px) and (max-width: 1024px) {
      left: -1.435rem;
      top: 0.0938rem;
    }
    @media only screen and (min-width: 1025px) and (max-width: 1079px) {
      left: -1.41rem;
      top: 0.0938rem;
    }
    @media only screen and (min-width: 1080px) and (max-width: 1167px) {
      left: -1.32rem;
      top: 0.0938rem;
    }
    @media only screen and (min-width: 1168px) and (max-width: 1234px) {
      left: -1.21rem;
    }
    @media only screen and (min-width: 1235px) and (max-width: 1299px) {
      left: -1.1517rem;
    }
    @media only screen and (min-width: 1300px) and (max-width: 1420px) {
      left: -1.0917rem;
    }
    @media only screen and (min-width: 1420px) and (max-width: 2580px) {
      left: -1.0417rem;
    }

    top: 0.0625rem;
    font-size: 0.0885rem;
    color: #1f1f20;
  }
  // 服务协议
  .agreement {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 25px;
    text-align: center;
    margin-top: 10px;
    user-select: none;
    span {
      font-size: 14px;
      color: #666;
      margin-left: 7px;
    }
    img {
      width: 15px;
      height: 15px;
      cursor: pointer;
    }
    a {
      cursor: pointer;
      font-size: 14px;
      color: #738bd0;
    }
  }
  // 按钮组
  .submit {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 50px;
    margin: 5px 0 5px 0;
    cursor: pointer;
    .btn {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 180px;
      height: 34px;
      background: #738bd0;
      border-radius: 4px;
      font-size: 18px;
      font-family: Source Han Sans SC;
      font-weight: 400;
      color: #ffffff;
      margin-right: 30px;
    }
    .btn1 {
      background-color: #bfbfbf;
    }
    // 提交按钮
    .btn3 {
      background-color: #ccc;
      &.active {
        background-color: #3f6ef2;
      }
      &.actives {
        background-color: rgba(10, 123, 224, 0.6);
      }
    }
  }
  // 弹出框
  .dialog-center {
    box-sizing: border-box;
    padding: 0 0.026rem;
    display: flex;
    justify-content: center;
    width: 100%;
    // 小屏
    @media only screen and (min-width: 900px) and (max-width: 1535px) {
      height: 3.05rem;
    }
    // 中屏
    @media only screen and (min-width: 1536px) and (max-width: 1919px) {
      height: 2.8rem;
    }
    // 大屏
    @media only screen and (min-width: 1920px) and (max-width: 2580px) {
      height: 3.4375rem;
    }
    .first {
      display: flex;
      justify-content: center;
      align-items: center;
      // 小屏
      @media only screen and (min-width: 900px) and (max-width: 1535px) {
        min-width: 3.125rem;
        height: 2.3958rem;
      }
      // 中屏
      @media only screen and (min-width: 1536px) and (max-width: 1919px) {
        width: 3.125rem;
        height: 2.3958rem;
      }
      // 大屏
      @media only screen and (min-width: 1920px) and (max-width: 2580px) {
        width: 3.9583rem;
        height: 3.0208rem;
      }

      background-color: #fff;

      h1 {
        font-size: 0.0938rem;
      }
    }
  }
  .dialog-footer {
    display: flex;
    justify-content: space-evenly;
    width: 70%;
    margin: 0 auto;
    .dialog-footer-bnt {
      width: 0.6302rem;
      height: 0.1615rem;
      color: #3f6ef2;
      border: 0.0052rem solid #3f6ef2;
      border-radius: 0.0208rem;
      background-color: #fff;
    }
    .btn2 {
      color: #fff;
      background-color: #3f6ef2;
      &.actives {
        background-color: rgba(10, 123, 224, 0.6);
        border: 0px;
      }
    }
  }
  .abc {
    width: 1.9167rem;
    .el-select {
      width: 100%;
    }
  }
  .dialog-center-hint {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 0.1042rem;
    font-size: 0.0885rem;
  }
}

::v-deep .hint .el-dialog {
  @media only screen and (min-width: 900px) and (max-width: 1535px) {
    width: 52%;
  }
  @media only screen and (min-width: 1536px) and (max-width: 1919px) {
    width: 50%;
  }
  @media only screen and (min-width: 1920px) and (max-width: 2580px) {
    width: 49%;
  }
}
::v-deep .hint .el-dialog__body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5px 20px;
}
// 协议
::v-deep .inviteAffirmClient .el-dialog {
  // 小屏
  @media only screen and (min-width: 900px) and (max-width: 1535px) {
    width: 45%;
    // background-color: #f0f;
  }
  // 中屏
  @media only screen and (min-width: 1536px) and (max-width: 1919px) {
    width: 45%;
    // background-color: #ff0;
  }
  // 大屏
  @media only screen and (min-width: 1920px) and (max-width: 2580px) {
    width: 50%;
    // background-color: #f00;
  }
}
::v-deep .el-dialog__header {
  border: 0;
  padding: 5px 20px;
}
/* 输入框样式  */
::v-deep .el-input__inner {
  box-sizing: border-box;
  width: 300px;
  @media only screen and (min-width: 1px) and (max-width: 910px) {
    width: 100px;
  }
  @media only screen and (min-width: 911px) and (max-width: 999px) {
    width: 150px;
  }
  @media only screen and (min-width: 1000px) and (max-width: 1150px) {
    width: 200px;
  }
  @media only screen and (min-width: 1151px) and (max-width: 1550px) {
    width: 250px;
  }
  height: 39px;
  font-size: 14px;
  border: 1px solid #e0e0e0;
  border-radius: 0px;
  padding: 10px 10px;
  color: #606266;
  outline: 0;
  line-height: 35px !important;
}
::v-deep .el-form-item__label {
  font-size: 0.0885rem;
  font-weight: 400;
  color: #1f1f20;
}
::v-deep .el-form-item__label {
  @media only screen and (min-width: 1000px) and (max-width: 1090px) {
    width: 280px !important;
  }
  @media only screen and (min-width: 1090px) and (max-width: 1150px) {
    width: 280px !important;
  }
  @media only screen and (min-width: 1150px) and (max-width: 1250px) {
    width: 260px !important;
  }
  @media only screen and (min-width: 1250px) and (max-width: 1300px) {
    width: 310px !important;
  }
  @media only screen and (min-width: 1300px) and (max-width: 1390px) {
    width: 310px !important;
  }
  @media only screen and (min-width: 1390px) and (max-width: 1475px) {
    width: 350px !important;
  }
  @media only screen and (min-width: 1475px) and (max-width: 1575px) {
    width: 350px !important;
  }
  @media only screen and (min-width: 1575px) and (max-width: 1675px) {
    width: 310px !important;
  }
  @media only screen and (min-width: 1675px) and (max-width: 1775px) {
    width: 310px !important;
  }
  @media only screen and (min-width: 1775px) and (max-width: 1875px) {
    width: 380px !important;
  }
  @media only screen and (min-width: 1875px) and (max-width: 2580px) {
    width: 380px !important;
  }
}
::v-deep .el-form-item__content {
  @media only screen and (min-width: 1000px) and (max-width: 1090px) {
    margin-left: 280px !important;
  }
  @media only screen and (min-width: 1090px) and (max-width: 1150px) {
    margin-left: 280px !important;
  }
  @media only screen and (min-width: 1150px) and (max-width: 1250px) {
    margin-left: 260px !important;
  }
  @media only screen and (min-width: 1250px) and (max-width: 1300px) {
    margin-left: 310px !important;
  }
  @media only screen and (min-width: 1300px) and (max-width: 1390px) {
    margin-left: 310px !important;
  }
  @media only screen and (min-width: 1390px) and (max-width: 1475px) {
    margin-left: 350px !important;
  }
  @media only screen and (min-width: 1475px) and (max-width: 1575px) {
    margin-left: 350px !important;
  }
  @media only screen and (min-width: 1575px) and (max-width: 1675px) {
    margin-left: 310px !important;
  }
  @media only screen and (min-width: 1675px) and (max-width: 1775px) {
    margin-left: 310px !important;
  }
  @media only screen and (min-width: 1775px) and (max-width: 1875px) {
    margin-left: 380px !important;
  }
  @media only screen and (min-width: 1875px) and (max-width: 2580px) {
    margin-left: 380px !important;
  }
}
</style>
